<?php 
defined('RUN_KATANA') or die('Restricted access');
class Article extends SitemapItem
{
	public $Description;
	public $Image;
	public $ImageObject;
	
	public function Article($values = '') 
	{ 
		self::setDataTablePrefix('sitemap_');
		self::setDataTable('pages');
		
		if(is_array($values))
		{ self::setValues($values); }
		
		self::setSubLoaded(false);
		self::setDataChanged(false);
	}
	
	public function getImageURL() { return PAGE_URL.self::getImage(); }
	public function getImageThumbURL() { return PAGE_URL.'thumbs/'.self::getImage(); }
	
	function uploadImage($file)
	{
		global $thumb;
		self::setImage(self::uploadObjectImage(PAGE_PATH, $file, $thumb['DEFAULT']));
		$this->ImageObject = new Image();
		$this->ImageObject->setFolderPath(PAGE_PATH);
		$this->ImageObject->setFolderUrl(PAGE_URL);
		$this->ImageObject->setFilename($this->Image);
	}
	
	function deleteImage()
	{
		global $thumb;
		self::setImage(self::deleteObjectImage(PAGE_PATH, self::getImage(), $thumb['DEFAULT']));
		unset($this->ImageObject);
	}
}
?>